{% extends '_otp.html' %}

{% block title %}
    解绑 MFA
{% endblock %}


{% block body_title %}
    解绑 MFA
{% endblock %}

{% block body_content %}
    <div class="cls-content-sm" style="width: 215px; min-width: 215px">
        <form name="verifyForm">
            <div class="text-center mar-btm">
                <img src="/static/images/otp_auth.png" alt="" width="72px" height="117">
            </div>

            <div class="form-group">
                <input type="text" name="otp_code" class="form-control" placeholder="安全码 (6位数字)" data-rule="6位安全码: required;" autocomplete="off">
            </div>
            <button class="btn btn-primary btn-sm btn-block">下一步</button>
        </form>
    </div>
{% endblock %}

{% block buttom_js %}
    <!--qrcode-->
    <script src="{{ url_for('static', filename='plugins/qrcode/qrcode.min.js') }}"></script>
    <!--bees-->
    <script src="{{ url_for('static', filename='js/bees.js') }}"></script>

    <script type="text/javascript">

        $(function () {
            $('form[name="verifyForm"]').on('submit', function () {
                setAjaxCSRFToken();
                $.ajax({
                    type: 'post',
                    url: '{{ url_for("users.user-otp-disable-unbind") }}',
                    data : {
                        'otp_code': $('input[name="otp_code"]').val()
                    },
                    success: function (result) {
                        if (result.code != 200) {
                            bees.tipError({
                                message: result.data.message
                            });
                        }else {
                            window.location.href = '{{ url_for("users.user-otp-disable-success") }}'
                        }
                    }
                });

                return false;
            })
        })

    </script>

{% endblock %}